package com.lx.pc.restful.wx;

import java.io.IOException;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;
import com.lx.pc.domain.vo.quotationtrend.QuotationtrendVo;
import com.lx.pc.service.quotationtrend.IQuotationtrendService;
import com.lx.pc.utils.OmsPage;

@Controller
@RequestMapping("/wx")
public class WxQuotationPriceController {

	/**
	 * 行情走势图
	 * @return
	 */
	@Resource(name = "quotationtrendService")
	private IQuotationtrendService quotationtrendService;
	
	/**
	 * 价格一览表
	 * @param v
	 * @param page
	 * @param size
	 * @return
	 * @throws IOException
	 */
	@ResponseBody
	@RequestMapping("/priceList")
    public  String priceList(QuotationtrendVo v,Integer page,Integer size) throws IOException {
        Map<String,Object> result = new HashMap<String, Object>();
        
        OmsPage<QuotationtrendVo> pages = quotationtrendService.findByQuotationtrend(v, page, size);
        result.put("quotationtrend", pages);
        return JSON.toJSONString(result);
	}
	
	/**
	 * 详情
	 * @param id
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/toPriceDetails.do")
	public String toPriceDetails(String id) {
		Map<String,Object> result = new HashMap<String, Object>();
		QuotationtrendVo quotationtrend = quotationtrendService.findByQuotationtrendId(new BigInteger(id));
		result.put("quotationtrend", quotationtrend);
		return JSON.toJSONString(result);
	}
	
}
